package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.Chart;
import cn.wolfcode.crm.mapper.ChartMapper;
import cn.wolfcode.crm.query.ChartclaimQueryObject;
import cn.wolfcode.crm.query.ChartsalesQueryObject;
import cn.wolfcode.crm.service.IChartService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class ChartService implements IChartService {
   @Autowired
    private ChartMapper chartMapper;


    public PageResult query(ChartsalesQueryObject qo) {
        int total = chartMapper.query4Count(qo);
        if(total == 0 ){
            return new PageResult(0, Collections.EMPTY_LIST);
        }
        List<Chart> rows = chartMapper.query4List(qo);
        System.out.println(rows);
        return new PageResult(total,rows);
    }

    public PageResult queryclaim(ChartclaimQueryObject qo) {
        int total = chartMapper.query4Countsclaim(qo);
        if(total == 0 ){
            return new PageResult(0, Collections.EMPTY_LIST);
        }
        List<Chart> rows = chartMapper.query4Listsclaim(qo);
        System.out.println(rows);
        return new PageResult(total,rows);
    }
}
